Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nominator_bond_less deletes bottom nomination bug #748

Merged
merged 26 commits into from
Aug 30, 2021

Conversation

4meta5
Copy link
Contributor

@4meta5 4meta5 commented Aug 28, 2021

  • patch existing code to prevent future inconsistent state
  • patch inconsistent state in migration via runtime upgrade (in-progress)

I had to make the visibility for some storage item and private functions pub(crate) for the unit test of the migration. I still feel better about pub(crate) than pub because pub allows direct access from the runtime context.

@4meta5 4meta5 added A3-inprogress Pull request is in progress. No review needed at this stage. C7-high Elevates a release containing this PR to "high priority". labels Aug 28, 2021
@4meta5 4meta5 added B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes D1-runtime-migration PR introduces code that might require downstream chains to run a runtime upgrade. labels Aug 28, 2021
Comment on lines 393 to 395
} else {
// reset self.bottom_nominators
self.bottom_nominators.push(top_bottom);
Copy link
Contributor Author

@4meta5 4meta5 Aug 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this line, the code above would pop the top bottom nomination every time this was called. This pop led to inconsistent Collator2 state, preventing proper exit by unreserving reserved balance.

We can find the nominators that were incorrectly removed by this bug by searching the CollatorState2.nominators: Vec<AccountId> for an account that is not in the top or bottom nominator sets. This is done in the migration code. If the nominator did not exit, the nomination might be in their NominatorState2.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is what patches the bug by the way. We forgot to push back after pop and it led to inadvertently removing nominations from CollatorState.

@4meta5 4meta5 marked this pull request as ready for review August 29, 2021 19:50
@crystalin
Copy link
Collaborator

crystalin commented Aug 29, 2021

Process to test it:

Get the fork of Moonriver

  • Generate the fork (@notlesh to provide the steps)
  • Modify 1 collator 6477c1006AB85E6D94E8E7371f23b782FE95ca6b (all occurences) by alice f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac
  • Modify eligibility to 100 "0x76310ee24dbd609d21d08ad7292757d0e48df801946c7a0cc54f1a4e51592741": "0x64"
  • Modify council/tech_committee to Alice only: "0x11f3ba2e1cdd6d62f2ff9b5589e7ff81ba7fb8745735dc3be2a2c61a72c39e78": "0x04f24ff3a9cf04c71dbc94d0b566f7a27b94566cac" & "0x8985776095addd4789fccbce8ca77b23ba7fb8745735dc3be2a2c61a72c39e78": "0x04f24ff3a9cf04c71dbc94d0b566f7a27b94566cac"
  • Change upgrade frequency "0x45323df7cc47150b3930e2666b0aa313c522231880238a0c56021b8744a00743": "0x0000a000005000000a00000000c8000000c800000a0000000a0000000600000006000000"

File available there: https://drive.google.com/file/d/1KmMsO4JvcvSDgl7dqzaY8Ruwe4woxNsV/view?usp=sharing

Start the node

target/release/moonbeam --chain ./fork-moonriver-400-422540-mod-alice.json --tmp --rpc-port 56101 --ws-port 56102 --port 56100 --alice --rpc-methods unsafe --rpc-cors all --db-cache 3000  --sealing 2000

Verify the data contains invalid state

Requires branch crystalin-scenarios

>yarn ts-node fixes/restore-unreserved-balance.ts --url ws://localhost:56102 --from 1 --scan-storage
Using range #1-#25 (25)
#1: NominatorLeftCollator (0xe566c8427bfe7fa78deed10523e411a6e2cc7a79 - 5000000000000000000)
#1: NominatorLeftCollator (0x2b7b0bbe362d631d79ff765862f6cd5cdc8a4eb3 - 148590000000000000000)
#1: NominatorLeftCollator (0xb8ac6ef01a6191c8689ad756b4a41dcad7021390 - 5000000000000000000)
#1: NominatorLeftCollator (0xe01ada32ad63ea1e021a3dd9c1c9baedfd5fbf11 - 5000000000000000000)
#1: NominatorLeftCollator (0x924b5edaaee5332e96afee38c38c68f4d734ad2d - 62230000000000000000)
#1: NominatorLeftCollator (0x51eca0433cd58426a23f14f7f9186d42cacc4ab5 - 24000000000000000000)

=========Checking
0x7c0272652ae69640703773850c4ede626acb77a5: (storage: undefined, computed: 14000000000000000000), free: 1642313664516906132, reversed: 14000000000000000000

Invalid #1 0x3abed:  26 nominations (top: 10, bottom: 11)
Invalid #1 0x457c2:  26 nominations (top: 10, bottom: 13)
Invalid #1 0x3d4fd:  22 nominations (top: 10, bottom: 11)
Invalid #1 0x5be35:  19 nominations (top: 10, bottom: 7)
Invalid #1 0x10a2f:  109 nominations (top: 10, bottom: 98)
Invalid #1 0xb5af2:  21 nominations (top: 10, bottom: 8)
Invalid #1 0x13a61:  174 nominations (top: 10, bottom: 163)
Invalid #1 0x872de:  23 nominations (top: 10, bottom: 11)
Invalid #1 0x37006:  20 nominations (top: 10, bottom: 8)
Invalid #1 0xb67fe:  10 nominations (top: 8, bottom: 0)
Invalid #1 0x2869e:  42 nominations (top: 10, bottom: 31)
Invalid #1 0x4b02b:  32 nominations (top: 10, bottom: 20)
Invalid #1 0x97913:  29 nominations (top: 10, bottom: 15)
Invalid #1 0x55d1f:  20 nominations (top: 10, bottom: 9)
Invalid #1 0x1ded3:  65 nominations (top: 10, bottom: 52)
Invalid #1 0x17aab:  65 nominations (top: 10, bottom: 53)
Invalid #1 0x2bcb7:  34 nominations (top: 10, bottom: 20)
Invalid #1 0x19eaa:  44 nominations (top: 10, bottom: 31)
Invalid #1 0x59fe5:  16 nominations (top: 10, bottom: 3)
Invalid #1 0x1980e:  50 nominations (top: 10, bottom: 38)
Invalid #1 0x693ab:  24 nominations (top: 10, bottom: 12)
Invalid #1 0x04186:  91 nominations (top: 10, bottom: 80)
Invalid #1 0xce106:  17 nominations (top: 10, bottom: 6)
Invalid #1 0x46189:  17 nominations (top: 10, bottom: 5)
Invalid #1 0x703df:  20 nominations (top: 10, bottom: 8)
Invalid #1 0xdd16c:  23 nominations (top: 10, bottom: 11)

At the checking we can see many collators with the wrong number of nominations

Performing runtime upgrade (with data migration)

Using this branch, and changing the runtime/moonriver/lib.rs spec_version to 466 (to verify the runtime upgrade later)
srtool build . --package moonriver-runtime to build the runtime

Using proposal to system.setCode (moonriver_runtime.compact.wasm (2,077,132 bytes)) on the council (using Alice account) and instant fast tracking it.

Refreshing polkadotJs page to see the moonriver/466 runtime

Verifying the data migration

>yarn ts-node fixes/restore-unreserved-balance.ts --url ws://localhost:56102 --from 1 --scan-storage
...
0x3abed:  21 nominations (top: 10, bottom: 11): Fixed !!
0x457c2:  23 nominations (top: 10, bottom: 13): Fixed !!
0x3d4fd:  21 nominations (top: 10, bottom: 11): Fixed !!
0x5be35:  17 nominations (top: 10, bottom: 7): Fixed !!
0x10a2f:  108 nominations (top: 10, bottom: 98): Fixed !!
0xb5af2:  18 nominations (top: 10, bottom: 8): Fixed !!
0x13a61:  173 nominations (top: 10, bottom: 163): Fixed !!
0x872de:  21 nominations (top: 10, bottom: 11): Fixed !!
0x37006:  18 nominations (top: 10, bottom: 8): Fixed !!
0xb67fe:  8 nominations (top: 8, bottom: 0): Fixed !!
0x2869e:  41 nominations (top: 10, bottom: 31): Fixed !!
0x4b02b:  30 nominations (top: 10, bottom: 20): Fixed !!
0x97913:  25 nominations (top: 10, bottom: 15): Fixed !!
0x55d1f:  19 nominations (top: 10, bottom: 9): Fixed !!
0x1ded3:  62 nominations (top: 10, bottom: 52): Fixed !!
0x17aab:  63 nominations (top: 10, bottom: 53): Fixed !!
0x2bcb7:  30 nominations (top: 10, bottom: 20): Fixed !!
0x19eaa:  41 nominations (top: 10, bottom: 31): Fixed !!
0x59fe5:  13 nominations (top: 10, bottom: 3): Fixed !!
0x1980e:  48 nominations (top: 10, bottom: 38): Fixed !!
0x693ab:  22 nominations (top: 10, bottom: 12): Fixed !!
0x04186:  90 nominations (top: 10, bottom: 80): Fixed !!
0xce106:  16 nominations (top: 10, bottom: 6): Fixed !!
0x46189:  15 nominations (top: 10, bottom: 5): Fixed !!
0x703df:  18 nominations (top: 10, bottom: 8): Fixed !!
0xdd16c:  21 nominations (top: 10, bottom: 11): Fixed !!

Verify the bug is not happening anymore

  • Using Balthazar to nominate 0x3abeDa9f0f920fDa379B59B042dd6625D9C86dF3 with 800 Token (to be in top list) (using 50, 50 for the nominations parameters to make it easier)
  • Using Balthazar to nominator bond less (5 token) which should trigger the bug

Run the script using from --from <1 block after the runtime upgrade or before the balthazar nomination block>

>yarn ts-node fixes/restore-unreserved-balance.ts --url ws://localhost:56102 --from 60 --scan-storage
Using range #60-#155 (96)
#64: Nomination (0x3cd0a705a2dc65e5b1e1205896baa2be8a07c6e0 + 800000000000000000000)
#115: NominationDecreased (0x3cd0a705a2dc65e5b1e1205896baa2be8a07c6e0 - 5000000000000000000)

=========Checking

Done in 46.17s.

We can see the events, and there is no report (inside Checking) of error

Double verification

  • Restoring the moonriver-runtime-400.wasm (using system.setCodeWithoutChecks and council/fast track)
  • Refresh polkadotjs
  • Using Balthazar to nominator bond less (5 token) (still on 0x3abeDa9f0f920fDa379B59B042dd6625D9C86dF3) which should trigger the bug

Run the script using from --from <1 block after the runtime upgrade or before the balthazar bond less block>

>yarn ts-node fixes/restore-unreserved-balance.ts --url ws://localhost:56102 --from 280 --scan-storage
Using range #280-#299 (20)
#284: NominationDecreased (0x3cd0a705a2dc65e5b1e1205896baa2be8a07c6e0 - 5000000000000000000)

=========Checking

Invalid #284 0x3abed:  22 nominations (top: 11, bottom: 10)
Done in 18.48s.

The error is still there, meaning the bug was in runtime-400 and the new runtime of this branch is not triggering it

@notlesh
Copy link
Contributor

notlesh commented Aug 29, 2021

https://github.com/PureStake/fork-off-substrate can be used to produce a new genesis file if needed (I'd use Alan's file if at all possible though). It includes all of the tweaks mentioned except for modifying the collator to be alice.

@4meta5
Copy link
Contributor Author

4meta5 commented Aug 30, 2021

Was Total also corrupted by the bug which removed the NominatorState without unreserving the balance?

@crystalin
Copy link
Collaborator

I didn't think of checking the total. I can add it to the script

@crystalin
Copy link
Collaborator

@4meta5 according to this data (#425111), the total seems broken too:

0x3abeda9f0f920fda379b59b042dd6625d9c86df3:  26  nominations [backing: 5573, counted: 5269] (top: 10  [amount: 4269], bottom:  11 [amount: 224 ])
0x457c23d4daa0082c5c932557cfcb38afd6613885:  31  nominations [backing: 4025, counted: 3455] (top: 10  [amount: 3355], bottom:  18 [amount: 428 ])
0x3d4fd17713eeaeab926fd13aa15b1a4fea21ded5:  21  nominations [backing: 7982, counted: 7799] (top: 10  [amount: 7634], bottom:  10 [amount: 132 ])
0x6e2179c27e6215a0f4030f72695afd3963c58cb4:  19  nominations [backing: 4050, counted: 3739] (top: 10  [amount: 3639], bottom:   9 [amount: 310 ])
0x5be3520734b8ebfab91b0e92c7f6b747c6e215ff:  19  nominations [backing: 3346, counted: 3141] (top: 10  [amount: 2978], bottom:   7 [amount: 155 ])
0x010202a6f849e42b6f9613279e2df840ce5fc788:  29  nominations [backing: 3893, counted: 3644] (top: 10  [amount: 2643], bottom:  19 [amount: 248 ])
0xdaa3eeef6b7e385efe20204e0a63001db10716c4:  3   nominations [backing: 180, counted: 180 ] (top: 3   [amount: 79  ], bottom:   0 [amount: 0   ])
0x015f0e320a1be51264dd9b9fa8271c18d49e54bb:  219 nominations [backing: 19491, counted: 11771] (top: 10  [amount: 11671], bottom: 209 [amount: 7720])
0x75ab7c93d03198fad6bb8494d1c07ec125ca5f63:  5   nominations [backing: 178, counted: 178 ] (top: 5   [amount: 78  ], bottom:   0 [amount: 0   ])
0x395940ccfb9d8ff2b5d4748a7a5b51bb2e7c6459:  23  nominations [backing: 6433, counted: 6306] (top: 10  [amount: 6186], bottom:  13 [amount: 127 ])
0xa6f71753f6fc8ea396c5f87085f8db51dd740f18:  8   nominations [backing: 322, counted: 322 ] (top: 8   [amount: 222 ], bottom:   0 [amount: 0   ])
0x10a2f17d8150b76359e9ced567fc348c71a74b46:  113 nominations [backing: 17289, counted: 13877] (top: 10  [amount: 12877], bottom: 102 [amount: 3223])
0xb7ab89933d2f16e6d183aadcc5032ba17d6a5aec:  18  nominations [backing: 7091, counted: 7023] (top: 10  [amount: 6353], bottom:   8 [amount: 67  ])
0x6e2b8c8734e9b0184e4b0193eeec2790c1bf2d2d:  18  nominations [backing: 5249, counted: 5076] (top: 10  [amount: 4076], bottom:   8 [amount: 173 ])
0xb5af23c862df4ba2114276594a6ac851674cdf1e:  20  nominations [backing: 4244, counted: 4068] (top: 10  [amount: 3753], bottom:   7 [amount: 141 ])
0x59a29c0509af78a0d5b343ac0b5885f3733bceff:  3   nominations [backing: 1170, counted: 1170] (top: 3   [amount: 1070], bottom:   0 [amount: 0   ])
0x13a61dac75e2f66721dcaeda726be1e636928800:  177 nominations [backing: 21334, counted: 15554] (top: 10  [amount: 13626], bottom: 166 [amount: 5554])
0xc930f6ed873fbda75614c1325f92bdaa19e4a4eb:  18  nominations [backing: 4059, counted: 3952] (top: 10  [amount: 3852], bottom:   8 [amount: 106 ])
0x872def818fe02eb8280282025214554037c201db:  22  nominations [backing: 12672, counted: 12535] (top: 10  [amount: 12325], bottom:  10 [amount: 87  ])
0x37006dd9d226425c901c5d7f9434c2fb8ac3f533:  24  nominations [backing: 4569, counted: 4227] (top: 10  [amount: 3532], bottom:  12 [amount: 305 ])
0xb67fe362017a679420c372489e6a2e14c19c0dd6:  10  nominations [backing: 1458, counted: 1433] (top: 8   [amount: 1201], bottom:   0 [amount: 0   ])
0x538c5415d3829ee26469f889c6e8df48e729a3d4:  15  nominations [backing: 4127, counted: 4088] (top: 10  [amount: 3988], bottom:   5 [amount: 38  ])
0x6b402db11d47a97860d5d51cb622c7d910b06ee6:  12  nominations [backing: 8639, counted: 8612] (top: 10  [amount: 8221], bottom:   2 [amount: 26  ])
0xf2cd771f0159f868c2fab1714bb506a6787536fb:  3   nominations [backing: 1705, counted: 1705] (top: 3   [amount: 21  ], bottom:   0 [amount: 0   ])
0x55dc3a01bd7f48a0ca904b172d51296e73b89dee:  13  nominations [backing: 4062, counted: 3946] (top: 10  [amount: 3339], bottom:   3 [amount: 115 ])
0x2869e58409ca3e286a89d8baec432b6bd42aa895:  44  nominations [backing: 10329, counted: 9733] (top: 10  [amount: 8733], bottom:  33 [amount: 562 ])
0x0612187bcf12ed8322d2cc4eaca05cbaaa6fc327:  74  nominations [backing: 22321, counted: 20225] (top: 10  [amount: 20125], bottom:  63 [amount: 1795])
0x4828e3d2a1c4b0a90a2a125b9d53204efaf876a5:  20  nominations [backing: 3608, counted: 3397] (top: 10  [amount: 2397], bottom:  10 [amount: 211 ])
0x0e72a8362d28650da72864b1cf00f6a5270cd585:  54  nominations [backing: 10541, counted: 9269] (top: 10  [amount: 8983], bottom:  44 [amount: 1271])
0x4b02b0812117e80ffbb31cb706e0528f53495ef0:  32  nominations [backing: 14476, counted: 14047] (top: 10  [amount: 13947], bottom:  20 [amount: 414 ])
0x97913a2100199d47c31a4296b36da8d12c605959:  28  nominations [backing: 3938, counted: 3515] (top: 10  [amount: 3314], bottom:  14 [amount: 269 ])
0x7d71ea17d73f32e055bc84651e711eafcadb86d0:  3   nominations [backing: 1182, counted: 1182] (top: 3   [amount: 987 ], bottom:   0 [amount: 0   ])
0x9403ef1fd209b51eed8754e492028c9265e18b8b:  7   nominations [backing: 316, counted: 316 ] (top: 7   [amount: 216 ], bottom:   0 [amount: 0   ])
0x55d1f6118db6fe98868eeb27002d3d8a054316f0:  20  nominations [backing: 4294, counted: 4063] (top: 10  [amount: 3452], bottom:   9 [amount: 224 ])
0xb4110b3a9c825fc877692a835ce2ad00eec2fa55:  7   nominations [backing: 369, counted: 369 ] (top: 7   [amount: 269 ], bottom:   0 [amount: 0   ])
0x1ded377bc421daae92a161a5bce7dba19133ab5d:  65  nominations [backing: 8787, counted: 6703] (top: 10  [amount: 6603], bottom:  52 [amount: 1784])
0x17aab7c41e2130203c7a3f3258b63fdd74553274:  66  nominations [backing: 15812, counted: 14091] (top: 10  [amount: 13407], bottom:  54 [amount: 1507])
0xee512e8bdb0d0f0cb424a0b0900dcf0b9b2a81e4:  6   nominations [backing: 231, counted: 231 ] (top: 6   [amount: 131 ], bottom:   0 [amount: 0   ])
0x2bcb75e8590f945596e44a94c6b9ba327745117a:  35  nominations [backing: 5552, counted: 4935] (top: 10  [amount: 3935], bottom:  21 [amount: 475 ])
0xdeb69be9dc2f977fcb1d3672ae544d943a7c5342:  10  nominations [backing: 1403, counted: 1403] (top: 10  [amount: 1303], bottom:   0 [amount: 0   ])
0x6477c1006ab85e6d94e8e7371f23b782fe95ca6b:  15  nominations [backing: 6350, counted: 6264] (top: 10  [amount: 5264], bottom:   5 [amount: 85  ])
0x940817a9b803fe30e06e06f5d7d2422f7ad06eb0:  2   nominations [backing: 1105, counted: 1105] (top: 2   [amount: 1005], bottom:   0 [amount: 0   ])
0x19eaa6aae65e4b02539de493a735b81d1d848829:  47  nominations [backing: 8040, counted: 6835] (top: 10  [amount: 6657], bottom:  34 [amount: 979 ])
0x816177e0aac55c519947abd662c335ba55fa5964:  2   nominations [backing: 135, counted: 135 ] (top: 2   [amount: 20  ], bottom:   0 [amount: 0   ])
0x59fe59853fd70fb7991585165165a0fd004bb98e:  17  nominations [backing: 4567, counted: 4428] (top: 10  [amount: 3978], bottom:   4 [amount: 54  ])
0x1980e75f1b1cdaae3b2f79664c7cb83b86a3d404:  51  nominations [backing: 19926, counted: 18310] (top: 10  [amount: 18209], bottom:  39 [amount: 1410])
0x693ab260de2a31c1b5d7dc9cb253b87ed9b1f385:  25  nominations [backing: 2833, counted: 2623] (top: 10  [amount: 2448], bottom:  13 [amount: 140 ])
0x0418656fdf3646968489b8e6af6c25562803c69d:  98  nominations [backing: 11487, counted: 9096] (top: 10  [amount: 8934], bottom:  87 [amount: 2322])
0xce1060f18b03361b47905e55992cc93503270a0c:  15  nominations [backing: 5696, counted: 5633] (top: 10  [amount: 5322], bottom:   4 [amount: 45  ])
0xbd7562319f1f0fd658e0cc4af5970ea45946b08f:  17  nominations [backing: 13438, counted: 13371] (top: 10  [amount: 13111], bottom:   7 [amount: 66  ])
0x461891503a7cc40cd5acd630907c940d2aa84bc8:  17  nominations [backing: 5111, counted: 4996] (top: 10  [amount: 3996], bottom:   4 [amount: 26  ])
0x703df467fe6ef01868d16fd7230c8e72fe2f7fef:  20  nominations [backing: 5835, counted: 5529] (top: 10  [amount: 5139], bottom:   7 [amount: 205 ])
0xdd16c266534c6729112b8aa501f797ec33c122f7:  24  nominations [backing: 4365, counted: 4018] (top: 10  [amount: 3484], bottom:  12 [amount: 324 ])
0xa5929b2e3083fb0a7814238b4e05235f659dcf81:  21  nominations [backing: 3756, counted: 3596] (top: 10  [amount: 3496], bottom:  11 [amount: 160 ])

* init naive not tested

* fix compilation errors, still needs tests

* test
@4meta5
Copy link
Contributor Author

4meta5 commented Aug 30, 2021

@crystalin both totals should be reset correctly after #751 was merged into this branch, but I was talking about storage value Total which also needed to be corrected. I just pushed the fix.

Copy link
Contributor

@tgmichel tgmichel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nitpicks

pallets/parachain-staking/src/lib.rs Outdated Show resolved Hide resolved
pallets/parachain-staking/src/lib.rs Outdated Show resolved Hide resolved
pallets/parachain-staking/src/lib.rs Outdated Show resolved Hide resolved
Co-authored-by: girazoki <gorka.irazoki@gmail.com>
@crystalin crystalin added the A8-mergeoncegreen Pull request is reviewed well. label Aug 30, 2021
@4meta5 4meta5 removed the A3-inprogress Pull request is in progress. No review needed at this stage. label Aug 30, 2021
@crystalin crystalin merged commit 8ed1470 into master Aug 30, 2021
@crystalin crystalin deleted the patch-staking-bond-less-deletes-bottom-nominator-bug branch August 30, 2021 15:02
crystalin pushed a commit that referenced this pull request Aug 30, 2021
* in progress

* update top nominators list upon changes and do not remove any bottom nominations

* test fix

* init migration to start to fix inconsistent state

* more progress on migration

* improve nomination increase decrease events

* fmt

* review and comment all uses of pop

* add two different errors for each source of inconsistency and init migration unit test

* add unreserve stakers extrinsic gated by root to unreserve the reserved non nominators

* in middle of testing migration and found bug wherein nominator can have no nominations after it runs

* fix migration, still needs weights

* rename root unreserve function and finish migration test

* last few changes to public visibility to keep the test without exposing storage write functionality to outside of crate

* fix comment

* Fix max nominators per collator upgrade bug (#751)

* init naive not tested

* fix compilation errors, still needs tests

* test

* fix total staked in hotfix_unreserve_nomination as well

* accept review comments

* fix weight returned in on runtime upgrade

* remove accounts due unreserved balance storage item and use btreemap in memory instead

* try fix

* no filtering condition on first migration loop

* merge migration functions into one function

* conservative weight estimate

* Update pallets/parachain-staking/src/lib.rs

Co-authored-by: girazoki <gorka.irazoki@gmail.com>

Co-authored-by: girazoki <gorka.irazoki@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A8-mergeoncegreen Pull request is reviewed well. B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes C7-high Elevates a release containing this PR to "high priority". D1-runtime-migration PR introduces code that might require downstream chains to run a runtime upgrade.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants